<?php
namespace App\Repositories\Teambition;

use Illuminate\Http\Request;

/**
 * Class TeambitionFilter
 * @package App\Repositories\User
 */
class TeambitionFilter
{
    protected $perPage;
    protected $sort;
    protected $name;
    protected $teambitionSign;

    public function __construct(Request $request)
    {
        $this->name = $request->get('name');
        $this->teambitionSign = $request->get('teambition_sign');
        $this->perPage = max(min((int)$request->get('per_page', 20), 500), 1);
        $this->sort = parseSortString($request->get('sort'));
    }

    /**
     * @return mixed
     */
    public function getTeambitionSign()
    {
        return $this->teambitionSign;
    }

    /**
     * @return mixed
     */
    public function getPerPage()
    {
        return $this->perPage;
    }

    /**
     * @return array
     */
    public function getSort(): array
    {
        return $this->sort;
    }

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }
}
